package homework.day05;

import java.awt.*;

/**
 * @author ThinkBook
 */
public class Test05 {
    public static void main(String[] args) {
        //1.实例化Car对象
        Car car = new Car();
        //2.给对象属性赋值
        car.setColor("黄色");
        car.setBrand("奔驰");
        car.setPrice(1000.0);
        //3.输出对象属性信息
        car.show();
        //4.对象调用方法，让车跑起来
        car.advance();
        car.BackOff();
    }

}
class Car{
    //属性定义：颜色 品牌 价格
    String color;
    String brand;
    double price;
    //方法定义：前进、后退
    public void setColor(String color){
        this.color = color;
    }
    public void  setBrand(String brand){
        this.brand = brand;
    }
    public void setPrice(double price){
        this.price = price;
    }
    public void advance(){
        System.out.println("正在前进");
    }
    public void BackOff(){
        System.out.println("正在后退");
    }
    public void show(){
        System.out.println("车的颜色是" +this.color);
        System.out.println("车的品牌是" + brand);
        System.out.println("车的价格是" + price);
    }


}
